<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script src="js/mock.js"></script>
<script>
    let arr = Mock.mock({
        "string|1-10": "★"
    });
    console.log(arr);
    console.log(Mock.mock({
        "number|+1": 202
    }));
    console.log(Mock.mock({
        "number|1-100": 0
    }));
    let books = [
        {id: 1, name: 'Java从入门到放弃', price: 80, createDate: '2020-07-01', count: 1},
        {id: 2, name: 'Vue从入门到放弃', price: 90, createDate: '2020-07-02', count: 1},
        {id: 3, name: 'Mysql从入门到放弃', price: 100.01, createDate: '2020-07-03', count: 1},
        {id: 4, name: '啥都从入门到放弃', price: 70.0001, createDate: '2020-07-04', count: 1},
        {id: 5, name: 'JavaScript从入门到放弃', price: 60.00, createDate: '2020-07-04', count: 1},
        {id: 6, name: 'JavaScript从入门到放弃', price: 50.00, createDate: '2020-07-04', count: 1}
    ];
    let Random = Mock.Random;
    Random.extend({
        getBookName: function () {
            let array = ["Java", "JavaScript", "Mysql", "JQuery", "HTML", "CSS", "Bootstrap",
                "Vue", "NodeJS", "React", "Less", "Express"];
            return this.pick(array);
        }
    })
    books = Mock.mock({
        "array|100": [
            {
                "id|+1": 1,
                name: '@getBookName 从入门到放弃',
                price: '@float(60, 100, 0, 2)',
                createDate: '@date("yyyy-MM-dd")',
                count: "@integer(1, 20)"
            }
        ]
    });
    console.log(books);
</script>
</body>
</html>